package org.ligson.springboot.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

@RestController
@RequestMapping("/api/smember")
public class SMemberController {
    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @GetMapping("/list")
    public Set<String> list() {
        String serviceModelsKey = "crux-metadata:service:crux-org:models";
        Set<String> entityNames = stringRedisTemplate.boundSetOps(serviceModelsKey).members();
        return entityNames;
    }
}
